package com.distribute.framework.core.sql.datasource;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Date;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

public class Lazy3qConnection implements Connection
{
	Connection proxy;
	boolean usered=false;
	Date last=new Date();
	
	Lazy3qConnectionListener listener;
	
	public Lazy3qConnection(Connection proxy)
	{
		last=new Date();
		this.proxy=proxy;
	}

	public void clearWarnings() throws SQLException
	{
		this.proxy.clearWarnings();
	}
	
	public void addConnectionEventListener(Lazy3qConnectionListener listener)
	{
		this.listener=listener;
	}

	public void close() throws SQLException
	{
		last=new Date();
		if(this.listener!=null)
			this.listener.connectionClosed(new Lazy3qConnectionEvent(this));
	}

	public void commit() throws SQLException
	{
		this.proxy.commit();
	}

	public Statement createStatement() throws SQLException
	{		
		return this.proxy.createStatement();
	}

	public Statement createStatement(int resultSetType, int resultSetConcurrency)throws SQLException
	{
		return this.proxy.createStatement(resultSetType, resultSetConcurrency);
	}

	public Statement createStatement(int resultSetType,
			int resultSetConcurrency, int resultSetHoldability)
			throws SQLException
	{
		return this.proxy.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public boolean getAutoCommit() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getAutoCommit();
	}

	public String getCatalog() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getCatalog();
	}

	public int getHoldability() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getHoldability();
	}

	public DatabaseMetaData getMetaData() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getMetaData();
	}

	public int getTransactionIsolation() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getTransactionIsolation();
	}

	public Map<String, Class<?>> getTypeMap() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getTypeMap();
	}

	public SQLWarning getWarnings() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.getWarnings();
	}

	public boolean isClosed() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.isClosed();
	}

	public boolean isReadOnly() throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.isReadOnly();
	}

	public String nativeSQL(String sql) throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.nativeSQL(sql);
	}

	public CallableStatement prepareCall(String sql) throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareCall(sql);
	}

	public CallableStatement prepareCall(String sql, int resultSetType,
			int resultSetConcurrency) throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareCall(sql, resultSetType, resultSetConcurrency);
	}

	public CallableStatement prepareCall(String sql, int resultSetType,
			int resultSetConcurrency, int resultSetHoldability)
			throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public PreparedStatement prepareStatement(String sql) throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql);
	}

	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
			throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql, autoGeneratedKeys);
	}

	public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
			throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql, columnIndexes);
	}

	public PreparedStatement prepareStatement(String sql, String[] columnNames)
			throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql, columnNames);
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType,
			int resultSetConcurrency) throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql, resultSetType, resultSetConcurrency);
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType,
			int resultSetConcurrency, int resultSetHoldability)
			throws SQLException
	{
		//  Auto-generated method stub
		return this.proxy.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public void releaseSavepoint(Savepoint savepoint) throws SQLException
	{
		this.proxy.releaseSavepoint(savepoint);
	}

	public void rollback() throws SQLException
	{
		this.proxy.rollback();
	}

	public void rollback(Savepoint savepoint) throws SQLException
	{
		this.proxy.rollback(savepoint);
	}

	public void setAutoCommit(boolean autoCommit) throws SQLException
	{
		this.proxy.setAutoCommit(autoCommit);
	}

	public void setCatalog(String catalog) throws SQLException
	{
		this.proxy.setCatalog(catalog);
	}

	public void setHoldability(int holdability) throws SQLException
	{
		this.proxy.setHoldability(holdability);
	}

	public void setReadOnly(boolean readOnly) throws SQLException
	{
		this.proxy.setReadOnly(readOnly);
	}

	public Savepoint setSavepoint() throws SQLException
	{
		return this.proxy.setSavepoint();
	}

	public Savepoint setSavepoint(String name) throws SQLException
	{
		return this.proxy.setSavepoint(name);
	}

	public void setTransactionIsolation(int level) throws SQLException
	{
		this.proxy.setTransactionIsolation(level);
	}

	public void setTypeMap(Map<String, Class<?>> map) throws SQLException
	{
		this.proxy.setTypeMap(map);
	}

	public boolean isUsered()
	{
		return this.usered;
	}

	public void setUsered(boolean usered)
	{
		this.usered = usered;
	}

	public Date getLast()
	{
		return last;
	}

	public void setLast(Date last)
	{
		this.last = last;
	}

	
	public <T> T unwrap(Class<T> iface) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public Clob createClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Blob createBlob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public NClob createNClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public SQLXML createSQLXML() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public boolean isValid(int timeout) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public void setClientInfo(String name, String value) throws SQLClientInfoException {
		// TODO Auto-generated method stub
		
	}

	
	public void setClientInfo(Properties properties) throws SQLClientInfoException {
		// TODO Auto-generated method stub
		
	}

	
	public String getClientInfo(String name) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Properties getClientInfo() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setSchema(String schema) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getSchema() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void abort(Executor executor) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getNetworkTimeout() throws SQLException {
		// TODO Auto-generated method stub
		return 0;
	}

	
}